﻿// -------------------------------------------------------------------------
//    @FileName         :    NFServiceLevel.cpp
//    @Author           :    gaoyi
//    @Date             :    2025/1/22
//    @Email            :    445267987@qq.com
//    @Module           :    NFServiceLevel
//
// -------------------------------------------------------------------------

#include "NFServiceLevel.h"

#include <NFPlayer.h>

CHARPTERCOMPLETEFLAGS* NFServiceLevel::CharpterCompleteFlags(NFPlayer* pPlayer)
{
    CHECK_NULL_RE_VAL(0, pPlayer, NULL);
    auto pLevelPart = pPlayer->GetPart<NFLevelPart>(PART_LEVEL);
    CHECK_NULL_RE_VAL(pPlayer->GetRoleID(), pLevelPart, NULL);

    return pLevelPart->CharpterCompleteFlags();
}

INSTANCECOMPLETEFLAGS* NFServiceLevel::InstanceCompleteFlags(NFPlayer* pPlayer)
{
    CHECK_NULL_RE_VAL(0, pPlayer, NULL);
    auto pLevelPart = pPlayer->GetPart<NFLevelPart>(PART_LEVEL);
    CHECK_NULL_RE_VAL(pPlayer->GetRoleID(), pLevelPart, NULL);

    return pLevelPart->InstanceCompleteFlags();
}

bool NFServiceLevel::CharpterIsBitSetted(NFPlayer* pPlayer, int iLevel)
{
    auto pFlags = CharpterCompleteFlags(pPlayer);
    if (pFlags)
    {
        return pFlags->IsBitSetted(iLevel);
    }
    return false;
}

bool NFServiceLevel::InstanceIsBitSetted(NFPlayer* pPlayer, int iLevel)
{
    auto pFlags = InstanceCompleteFlags(pPlayer);
    if (pFlags)
    {
        return pFlags->IsBitSetted(iLevel);
    }
    return false;
}
